Skip to content

Conversation

@michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Aug 11, 2025

Resolves #17932

Summary by CodeRabbit

  • New Features
    • Added actions to send Broadcast, Multicast, Push, and Reply messages via LINE.
    • Introduced “New Message Received (Instant)” source to emit events on incoming messages with automatic webhook setup.
    • Added optional setting to disable notifications for outgoing messages.
  • Chores
    • Updated LINE Messaging API component version and dependencies.

@vercel
Copy link

vercel bot commented Aug 11, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Ignored (Inspect) Aug 11, 2025 7:23pm
pipedream-docs ⬜️ Ignored (Inspect) Aug 11, 2025 7:23pm
pipedream-docs-redirect-do-not-edit ⬜️ Ignored (Inspect) Aug 11, 2025 7:23pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 11, 2025

Walkthrough

Introduces LINE Messaging API support: adds client methods, four message-sending actions (broadcast, multicast, push, reply), a webhook base with activation logic, a “New Message Received (Instant)” source handling incoming events, a test event fixture, and updates package.json with dependency and version.

Changes

Cohort / File(s) Summary of Changes
Actions: Send Message Variants
components/line_messaging_api/actions/send-broadcast-message/send-broadcast-message.mjs, .../send-multicast-message/send-multicast-message.mjs, .../send-push-message/send-push-message.mjs, .../send-reply-message/send-reply-message.mjs
Added four actions invoking LINE API wrappers to send text messages: broadcast, multicast (to[]), push (to), and reply (replyToken). Each supports notificationDisabled (default false) and exports run summaries.
App Client & Helpers
components/line_messaging_api/line_messaging_api.app.mjs
Added propDefinitions (message, notificationDisabled), HTTP request helpers, and API wrapper methods: create/get webhook, send push/reply/multicast/broadcast. Removed authKeys(). Uses @pipedream/platform axios.
Webhook Base & Source
components/line_messaging_api/sources/common/base-webhook.mjs, components/line_messaging_api/sources/new-message-received/new-message-received.mjs, .../new-message-received/test-event.mjs
Introduced base webhook with activate hook to set endpoint. Added “New Message Received (Instant)” source to emit message events; includes generateMeta and a static test event fixture.
Package Metadata
components/line_messaging_api/package.json
Bumped version to 0.1.0 and added dependency on @pipedream/platform ^3.1.0.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant Action as Pipedream Action
  participant App as LINE App Wrapper
  participant LINE as LINE Messaging API

  User->>Action: Provide inputs (to/message/flags)
  Action->>App: sendPush/Reply/Multicast/Broadcast(data)
  App->>LINE: POST /message/{operation}
  LINE-->>App: API response
  App-->>Action: Response
  Action-->>User: $summary + response
Loading
sequenceDiagram
  participant Source as Source (New Message Received)
  participant Base as Base Webhook
  participant App as LINE App Wrapper
  participant LINE as LINE Messaging API

  activate Source
  Source->>Base: hooks.activate()
  Base->>App: getWebhook()
  App->>LINE: GET /channel/webhook/endpoint
  LINE-->>App: Endpoint (or 404)
  Base->>App: createWebhook({ endpoint: http.endpoint })
  App->>LINE: PUT /channel/webhook/endpoint
  LINE-->>App: OK
  deactivate Source

  LINE->>Source: POST webhook payload
  Source->>Source: Validate events and type==="message"
  Source-->>Source: generateMeta()
  Source-->>Source: $emit(event, meta)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Assessment against linked issues

Objective Addressed Explanation
Implement action(s) to send message via LINE Messaging API (#17932)
Use LINE Messaging API per referenced docs (#17932)

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
Add base webhook with activate hook to manage webhook endpoint (components/line_messaging_api/sources/common/base-webhook.mjs) Not requested in the “Send message” action issue; pertains to inbound webhook management.
Add “New Message Received (Instant)” source handling incoming events (components/line_messaging_api/sources/new-message-received/new-message-received.mjs) Implements event ingestion, not part of sending messages.
Add test event fixture for webhook source (components/line_messaging_api/sources/new-message-received/test-event.mjs) Test data for the new source; unrelated to sending messages action objective.

Suggested labels

ai-assisted

Suggested reviewers

  • jcortes

Poem

Hoppity hop, I press “send” with delight,
Messages bound on a swift LINE flight.
Push, reply, multi-cast in queue—
Broadcast breezes to everyone too.
Ears up high, I squeak “All set!”
Carrots clicked, no regrets. 🥕✉️

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch issue-17932

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (5)
components/line_messaging_api/line_messaging_api.app.mjs (2)

7-11: Tighten copy: minor grammar improvement

“The text of message to send” → “The text of the message to send”.

     message: {
       label: "Message Text",
       type: "string",
-      description: "The text of message to send",
+      description: "The text of the message to send",
     },

12-18: Clarify notificationDisabled semantics (current description is misleading)

The label suggests disabling notifications, but the description says users will receive notifications. Update to reflect true semantics.

     notificationDisabled: {
-      label: "Disable Notification",
+      label: "Disable Notifications",
       type: "boolean",
-      description: "The user will receive a push notification when the message is sent",
+      description: "If true, the user will not receive a push notification when the message is sent",
       default: false,
       optional: true,
     },
components/line_messaging_api/actions/send-multicast-message/send-multicast-message.mjs (1)

11-15: Clarify recipient constraints in the description

Add note on allowed range per LINE API (2–500 userIds).

     to: {
       label: "To",
       type: "string[]",
-      description: "An array of user IDs to send the message to",
+      description: "An array of user IDs to send the message to (between 2 and 500 recipients)",
     },
components/line_messaging_api/actions/send-push-message/send-push-message.mjs (1)

12-15: Clarify recipient identifier wording

Small copy tweak to explicitly call out userId, groupId, or roomId.

     to: {
       label: "To",
       type: "string",
-      description: "The ID of user, group, or room the message will be sent to",
+      description: "The userId, groupId, or roomId to send the message to",
     },
components/line_messaging_api/sources/new-message-received/new-message-received.mjs (1)

12-21: Consider defensive handling for non-text messages.

The generateMeta implementation looks good, but consider handling cases where event.message.text might be undefined for non-text message types (images, stickers, etc.).

 generateMeta(event) {
   return {
     id: event.message.id,
-    summary: event.message.text,
+    summary: event.message.text || `${event.message.type} message`,
     ts: event.timestamp,
   };
 },
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6989cbc and 34ce3e8.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (9)
  • components/line_messaging_api/actions/send-broadcast-message/send-broadcast-message.mjs (1 hunks)
  • components/line_messaging_api/actions/send-multicast-message/send-multicast-message.mjs (1 hunks)
  • components/line_messaging_api/actions/send-push-message/send-push-message.mjs (1 hunks)
  • components/line_messaging_api/actions/send-reply-message/send-reply-message.mjs (1 hunks)
  • components/line_messaging_api/line_messaging_api.app.mjs (1 hunks)
  • components/line_messaging_api/package.json (2 hunks)
  • components/line_messaging_api/sources/common/base-webhook.mjs (1 hunks)
  • components/line_messaging_api/sources/new-message-received/new-message-received.mjs (1 hunks)
  • components/line_messaging_api/sources/new-message-received/test-event.mjs (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2024-07-24T02:06:47.016Z
Learnt from: GTFalcao
PR: PipedreamHQ/pipedream#12697
File: components/salesforce_rest_api/sources/common-webhook-methods.mjs:1-71
Timestamp: 2024-07-24T02:06:47.016Z
Learning: The `common-webhook-methods.mjs` object is designed to be extended, similar to an abstract class, and intentionally does not implement certain methods like `generateWebhookMeta` and `getEventType` to enforce implementation in subclasses.

Applied to files:

  • components/line_messaging_api/sources/common/base-webhook.mjs
📚 Learning: 2024-12-12T19:23:09.039Z
Learnt from: jcortes
PR: PipedreamHQ/pipedream#14935
File: components/sailpoint/package.json:15-18
Timestamp: 2024-12-12T19:23:09.039Z
Learning: When developing Pipedream components, do not add built-in Node.js modules like `fs` to `package.json` dependencies, as they are native modules provided by the Node.js runtime.

Applied to files:

  • components/line_messaging_api/package.json
🧬 Code Graph Analysis (4)
components/line_messaging_api/actions/send-reply-message/send-reply-message.mjs (3)
components/line_messaging_api/actions/send-multicast-message/send-multicast-message.mjs (1)
  • response (30-42)
components/line_messaging_api/actions/send-broadcast-message/send-broadcast-message.mjs (1)
  • response (25-36)
components/line_messaging_api/actions/send-push-message/send-push-message.mjs (1)
  • response (30-42)
components/line_messaging_api/actions/send-multicast-message/send-multicast-message.mjs (3)
components/line_messaging_api/actions/send-broadcast-message/send-broadcast-message.mjs (1)
  • response (25-36)
components/line_messaging_api/actions/send-push-message/send-push-message.mjs (1)
  • response (30-42)
components/line_messaging_api/actions/send-reply-message/send-reply-message.mjs (1)
  • response (30-42)
components/line_messaging_api/actions/send-broadcast-message/send-broadcast-message.mjs (3)
components/line_messaging_api/actions/send-multicast-message/send-multicast-message.mjs (1)
  • response (30-42)
components/line_messaging_api/actions/send-push-message/send-push-message.mjs (1)
  • response (30-42)
components/line_messaging_api/actions/send-reply-message/send-reply-message.mjs (1)
  • response (30-42)
components/line_messaging_api/actions/send-push-message/send-push-message.mjs (3)
components/line_messaging_api/actions/send-multicast-message/send-multicast-message.mjs (1)
  • response (30-42)
components/line_messaging_api/actions/send-broadcast-message/send-broadcast-message.mjs (1)
  • response (25-36)
components/line_messaging_api/actions/send-reply-message/send-reply-message.mjs (1)
  • response (30-42)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Lint Code Base
  • GitHub Check: pnpm publish
🔇 Additional comments (18)
components/line_messaging_api/package.json (2)

3-3: Version bump looks good

Package version update to 0.1.0 aligns with introducing new public surface (app wrappers, actions, source).


15-17: Dependency addition is appropriate and compliant with org learnings

Adding "@pipedream/platform" is required for axios usage in the app. Also, thanks for not adding built-in Node modules as dependencies—this follows our learning on avoiding native modules in package.json.

components/line_messaging_api/sources/new-message-received/test-event.mjs (1)

1-19: Sample event LGTM

Shape matches a LINE message event and is suitable for sampleEmit. Values appear non-sensitive.

components/line_messaging_api/line_messaging_api.app.mjs (3)

35-75: Endpoint wrappers map correctly to LINE Messaging API

createWebhook/getWebhook and message send (push/reply/multicast/broadcast) routes look correct and consistent.


24-33: Require valid step context ($) and set JSON content-type in requests

Defaulting $ = this may mask missing or invalid step contexts and lead to runtime errors in the Pipedream axios client. Enforce $ as a required parameter and explicitly set the JSON content‐type header for all requests.

Suggested diff:

-  _makeRequest({
-    $ = this, path, ...opts
-  }) {
-    return axios($, {
+  _makeRequest({ $, path, ...opts }) {
+    if (!$) {
+      throw new Error("Missing step context ($). Pass {$} when calling app methods.");
+    }
+    return axios($, {
       url: `${this._baseUrl()}${path}`,
       headers: {
         Authorization: `Bearer ${this.$auth.long_lived_channel_access_token}`,
+        "Content-Type": "application/json",
       },
       ...opts,
     });

• I ran the provided grep commands to confirm all callers pass {$}, but they returned no matches under components/line_messaging_api/.
• Please manually verify that every invocation of your app methods (e.g. sendPushMessage, replyMessage, getWebhook, etc.) includes the step context object { $ }.


29-31: Confirm auth token key matches the app auth schema
The _makeRequest method uses this.$auth.long_lived_channel_access_token for the Authorization header, but this file doesn’t define any auth props. Please verify that your app’s auth configuration declares a secret named long_lived_channel_access_token (not, for example, channel_access_token), or update the code to use the correct $auth field—otherwise API calls will fail with 401 Unauthorized.

components/line_messaging_api/actions/send-push-message/send-push-message.mjs (1)

29-45: Run logic LGTM

Payload structure and wrapper usage are correct; summary is helpful.

components/line_messaging_api/actions/send-broadcast-message/send-broadcast-message.mjs (3)

1-8: LGTM!

The import path and action structure follow standard Pipedream patterns correctly.


9-23: LGTM!

Props structure is consistent with other LINE messaging actions and correctly uses propDefinitions for shared properties.


24-40: LGTM!

The run function implementation correctly follows the LINE API structure and is consistent with other messaging actions in the PR. The nullish coalescing operator usage and summary export are appropriate.

components/line_messaging_api/actions/send-reply-message/send-reply-message.mjs (3)

1-8: LGTM!

Import and action structure are consistent with other LINE messaging actions.


9-28: LGTM!

Props structure correctly adds the reply-specific replyToken prop while reusing shared propDefinitions for common properties.


29-46: LGTM!

The run function correctly implements the reply message pattern with the required replyToken field and provides a helpful summary message.

components/line_messaging_api/sources/common/base-webhook.mjs (2)

1-8: LGTM!

Import statements and base structure are appropriate for a webhook base class.


9-26: LGTM!

The activate hook implementation correctly sets up the webhook with appropriate error handling and user guidance. The sequence of operations and error messaging provide good developer experience.

components/line_messaging_api/sources/new-message-received/new-message-received.mjs (3)

1-11: LGTM!

Import statements and source structure correctly extend the base webhook with appropriate metadata.


22-32: LGTM!

The run function correctly handles LINE webhook events with proper filtering and emission. The early return and event type filtering are appropriate defensive programming practices.


33-34: LGTM!

Sample emit usage follows standard Pipedream patterns.

Copy link
Collaborator

@luancazarine luancazarine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @michelle0927, LGTM! Ready for QA!

@vunguyenhung vunguyenhung merged commit ee7fd7d into master Aug 13, 2025
11 checks passed
@vunguyenhung vunguyenhung deleted the issue-17932 branch August 13, 2025 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ACTION] Send message with Line

4 participants